<template>
  <div class="myDiv">
    <el-table
    :data="tableData"
    height="500"
    border
    style="width: 100%;margin-top: 10px;height: 570px;" >
    <el-table-column
      prop="noticeTitle"
      label="公告标题"
      width="180"
      align="center">
      <template slot-scope="scope">
        <el-link type="primary" @click="detail(scope.row)">{{ scope.row.noticeTitle }}</el-link>
        </template>
    </el-table-column>
    <el-table-column
      prop="noticeType"
      label="公告类型"
      width="120"
      align="center">
      <template slot-scope="scope">
          <dict-tag :options="dict.type.sys_notice_type" :value="scope.row.noticeType"/>
        </template>
    </el-table-column>
    <el-table-column
      prop="createTime"
      label="发布时间"
      align="center">
    
    </el-table-column>
  </el-table>
  <el-dialog
  :title="dialogcontent.title"
  :visible.sync="dialogVisible"
  width="50%"
  >
  <span v-html="dialogcontent.content"></span>
  <span slot="footer" class="dialog-footer">
    <el-button @click="dialogVisible = false">取 消</el-button>
    <el-button type="primary" @click="ensure()">确 定</el-button>
  </span>
</el-dialog>
  </div>
</template>

<script>
import { listNotice, getNotice, delNotice, addNotice, updateNotice } from "@/api/system/notice";
import { mapState } from 'vuex'

export default {
  name: '',
  dicts: ['sys_notice_status', 'sys_notice_type'],
  computed: {
    ...mapState({
      firstLogin: state => state.user.firstLogin,



    
    }),
    
  },
  components:{
},
  props:{
},

  data(){
    return {
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        noticeTitle: undefined,
        createBy: undefined,
        status: undefined
      },
      tableData: [],
      dialogcontent:{
        title:null,
        content:null
      },
      dialogVisible: false
    }
  },
  watch:{
},

  methods:{
    ensure(){
      this.dialogVisible = false 
      this.$store.commit('SET_FIRSTLOGIN',false);
      console.log(this.firstLogin);
    },
    detail(item){
      console.log("sdafasdf");
      console.log(item);
this.dialogVisible =true
this.dialogcontent.title = item.noticeTitle
this.dialogcontent.content = item.noticeContent

    },
    getList() {
      this.loading = true;
      listNotice(this.queryParams).then(response => {

        this.tableData =response.rows
  console.log(this.firstLogin);
      if (this.firstLogin === true) {
        this.detail(response.rows[0])
         }
      });
    },
},
  created(){
    this.getList() 
},

}
</script>
<style lang="scss" scoped>




</style>